package com.onemore.task.location;

import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import org.voovan.tools.log.Logger;

import com.alibaba.fastjson.JSONObject;
import com.onemore.task.JdbcGlobal;

public class ModelSpjhdCompare extends JdbcGlobal{
	final static private String fields[] = new String[] {"SyncBillId","BILLOUTDATE","QTYIN","SL"};

    static public List<Map<String, Object>> getCompareList() throws SQLException
    {
    	String sql = "";
        sql = "SELECT wms.BillId, DJBH, CheckDate, MAX(YDJH) AS YDJH , SUM(QTYIN) AS QTYIN, SUM(SL) AS SL FROM TBillNotePurchase wms LEFT JOIN ( SELECT DJBH, YDJH, RQ, SL FROM PSEND UNION ALL SELECT DJBH, YDJH, RQ, SL FROM DSEND ) erp ON erp.YDJH = wms.BillId LEFT JOIN TBillStockPurchaseDet det ON det.BillId = wms.BillId WHERE (erp.DJBH IS NULL OR erp.SL != det.QTYIN OR erp.YDJH IS NULL) AND DateDiff(yy, RQ, '2018') < 0 AND DateDiff(yy, CreateDate, '2018') < 0 GROUP BY wms.BillId, DJBH, CheckDate";
    	List<Map<String, Object>> manyMaps = null;
		manyMaps = getJdbcOperate().queryMapList(sql);
		return manyMaps;
    }
}
